﻿<Window x:Class="CarViewer.CarWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:g="clr-namespace:BodyGestIT;assembly=BodyTmpLib"
        Title="MainWindow" Height="370" Width="752" xmlns:my="clr-namespace:CarViewer" xmlns:my1="clr-namespace:Microsoft.Kinect.Toolkit;assembly=Microsoft.Kinect.Toolkit" 
        xmlns:kwv="clr-namespace:Microsoft.Samples.Kinect.WpfViewers;assembly=Microsoft.Samples.Kinect.WpfViewers"
        Loaded="Window_Loaded" Closing="Window_Closing" Closed="Window_Closed">
    <Window.Resources>
        <SolidColorBrush x:Key="redBackground" Color="#FF970000"/>
        <SolidColorBrush x:Key="greenBackground" Color="#FF009700"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="0.3*"/>
            </Grid.ColumnDefinitions>
            <g:GestureDefinition x:Name="moveCar">
                <g:Sequence g:Iterative="True">
                    <g:Change Feature="ShoulderRight" Accepts="front">
                        <g:Change.Completed>
                            <g:Handler method="screenFrontExp_Completed" />
                        </g:Change.Completed>
                    </g:Change>
                    <g:Choice g:Iterative="True">
                        <g:Sequence>
                            <g:Change Feature="OpenRightHand" Accepts="onlyRightHandClosed">
                                <g:Change.Completed>
                                    <g:Handler method="openHand_Completed"/>
                                    <!--<g:Handler method="screenFrontExp_Completed" />-->
                                </g:Change.Completed>
                            </g:Change>
                            <g:Disabling>
                                <g:Change Feature="HandRight" Accepts="rightHandMove" Iterative="True">
                                    <g:Change.Completed>
                                        <g:Handler method="rightHandMoveExp_Completed"/>
                                    </g:Change.Completed>
                                </g:Change>
                                <g:Sequence>
                                    <g:Change Feature="OpenRightHand" Accepts="rightHandOpened">
                                        <g:Change.Completed>
                                            <g:Handler method="openHand3_Completed"/>
                                        </g:Change.Completed>
                                    </g:Change>
                                    <g:Change Feature="OpenRightHand" Accepts="rightHandClosed"/>
                                </g:Sequence>
                            </g:Disabling>
                        </g:Sequence>
                        <g:Sequence>
                            <g:Sequence.Completed>
                                <g:Handler method="gesture_Completed"/>
                            </g:Sequence.Completed>
                            <g:Sequence.Error>
                                <g:Handler method="gesture_Error"/>
                            </g:Sequence.Error>
                            <g:SynchronizedParallel>
                                <g:SynchronizedParallel.Completed>
                                    <g:Handler method="rotateHandOpen_Completed"/>
                                    <!--<g:Handler method="screenFrontExp_Completed" />-->
                                </g:SynchronizedParallel.Completed>
                                <g:Change Feature="OpenRightHand" Accepts="rightHandClosed">
                                    <g:Change.Completed>
                                        <g:Handler method="rightHandClosed_Completed"/>
                                    </g:Change.Completed>
                                </g:Change>
                                <g:Change Feature="OpenLeftHand" Accepts="leftHandClosed">
                                    <g:Change.Completed>
                                        <g:Handler method="leftHandClosed_Completed"/>
                                    </g:Change.Completed>
                                </g:Change>
                            </g:SynchronizedParallel>
                            <g:Disabling>
                                <g:SynchronizedParallel>
                                    <g:Change Feature="HandLeft" Accepts="rightHandMove" Iterative="True"/>
                                    <g:Change Feature="HandRight" Accepts="rightHandMove" Iterative="True">
                                        <g:Change.Completed>
                                            <g:Handler method="rightHandMoveExp_RotationCompleted"/>
                                        </g:Change.Completed>
                                    </g:Change>
                                </g:SynchronizedParallel>
                                <g:SynchronizedParallel>
                                    <g:Sequence>
                                        <g:Change Feature="OpenRightHand" Accepts="rightHandOpened">
                                            <g:Change.Completed>
                                                <g:Handler method="openHand3_Completed"/>
                                            </g:Change.Completed>
                                        </g:Change>
                                        <g:Change Feature="OpenRightHand" Accepts="rightHandClosed">

                                        </g:Change>
                                    </g:Sequence>
                                    <g:Sequence>
                                        <g:Change Feature="OpenLeftHand" Accepts="leftHandOpened">
                                            <g:Change.Completed>
                                                <g:Handler method="openHand4_Completed"/>
                                            </g:Change.Completed>
                                        </g:Change>
                                        <g:Change Feature="OpenLeftHand" Accepts="leftHandClosed">

                                        </g:Change>
                                    </g:Sequence>
                                </g:SynchronizedParallel>
                            </g:Disabling>
                        </g:Sequence>
                    </g:Choice>
                </g:Sequence>
            </g:GestureDefinition>
            <Canvas x:Name="MoveArrow" Visibility="Hidden" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top">
                <Path Stroke="Black" Fill="Red" Data="M 10 20 L 30 10 L 10 0 L 10 5 L 0 5 L 0 15 L 10 15 Z" StrokeThickness="3">
                    <Path.RenderTransform>
                        <TranslateTransform X="10" Y="35" />
                    </Path.RenderTransform>
                </Path>
                <Path Stroke="Black" Fill="Red" Data="M 10 20 L 30 10 L 10 0 L 10 5 L 0 5 L 0 15 L 10 15 Z" StrokeThickness="3">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <RotateTransform Angle="180" />
                            <TranslateTransform X="30" Y="20" />
                            <TranslateTransform X="-40" Y="35" />
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
                <Path Stroke="Black" Fill="Red" Data="M 10 20 L 30 10 L 10 0 L 10 5 L 0 5 L 0 15 L 10 15 Z" StrokeThickness="3">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <RotateTransform Angle="90" />
                            <TranslateTransform X="30" Y="20" />
                            <TranslateTransform X="-20" Y="35" />
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
                <Path Stroke="Black" Fill="Red" Data="M 10 20 L 30 10 L 10 0 L 10 5 L 0 5 L 0 15 L 10 15 Z" StrokeThickness="3">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <RotateTransform Angle="270" />
                            <TranslateTransform X="30" Y="20" />
                            <TranslateTransform X="-40" Y="15" />
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
            </Canvas>
            <Canvas x:Name="Rotate" Visibility="Hidden" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" >
                <Path x:Name="Path" Width="51.5799" Height="64" Canvas.Left="0" Canvas.Top="1.99998" Stretch="Fill"  StrokeThickness="3" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FFFF0000" Data="F1 M 53.0616,51.5946C 62.3963,47.1013 71.7311,42.6081 72.8664,37.8784C 74.0017,33.1486 66.9376,28.1824 59.8734,23.2162L 59.8734,34.4257L 32.5,18.8176L 60.3617,2.49998L 60.1257,13.5675C 72.1515,21.5608 84.1773,29.554 83,38.2094C 81.8226,46.8649 67.4421,56.1824 53.0616,65.5L 53.0616,51.5946 Z "/>
                <Path x:Name="Path_0" Width="47.2398" Height="63.1667" Canvas.Right="0" Canvas.Top="20.1667" Stretch="Fill" StrokeThickness="3"  StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FFFF0000" Data="F1 M 32.8694,34.3881C 24.3357,38.8219 15.802,43.2557 14.7641,47.9229C 13.7262,52.5901 20.1841,57.4906 26.6421,62.3911L 26.6421,51.3299L 51.6667,66.7316L 26.1957,82.8333L 26.4115,71.9122C 15.4176,64.0246 4.42367,56.1371 5.49999,47.5962C 6.57631,39.0553 19.7229,29.861 32.8694,20.6667L 32.8694,34.3881 Z "/>

            </Canvas>
            <my:CarControl  Grid.Column="0" HorizontalAlignment="Stretch" x:Name="carControl1" VerticalAlignment="Stretch" Width="Auto" Height="Auto"  />
            <my1:KinectSensorChooserUI Grid.Column="0" Grid.RowSpan="2"   Name="kinectSensorChooser1" VerticalAlignment="Center" Width="328" />
            <kwv:KinectSkeletonViewer Grid.Column="1"  ShowJoints="True" x:Name="kinectSkeletonViewer1" VerticalAlignment="Top" HorizontalAlignment="Stretch" Width="152" Height="110"   KinectSensorManager="{Binding}" />
            <kwv:KinectColorViewer Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,110,0,0" x:Name="kinectColorViewer1" VerticalAlignment="Top" Height="111" Width="152"  KinectSensorManager="{Binding}"/>
            <Label Content="Not Tracking" Grid.Column="1" Height="48" HorizontalAlignment="Stretch" Margin="8,227,0,0" Name="label1" VerticalAlignment="Top" FontSize="18" FontWeight="Bold" Width="155" Background="#FF970000" Foreground="White" />
        </Grid>
    </Grid>
</Window>
